package 对象;

public class Phone {
    //手机的品牌
    private String pp;
    //手机的价格
    private double price;
    //手机的颜色
    private String color;


    //空参
    public Phone(){}
    //全部参数
    public Phone(String pp , double price , String color){
        this.color = color;
        this.pp = pp;
        //价格不能为负数
        if (price <= 0) {
            System.out.println("参数错误，价格不能为负数或者零！！");
        }else {
            this.price = price;
        }
    }

    public void setPp(String pp){
        this.pp = pp;
    }
    public String getPp() {
        return pp;
    }

    public void setPrice(double price) {
        //价格不能为负数
        if (price <= 0) {
            System.out.println("参数错误，价格不能为负数或者零！！");
        }else {
            this.price = price;
        }
    }

    public double getPrice() {
        return price;
    }

    public void setColor(String color) {
        this.color = color;
    }
    public String getColor() {
        return color;
    }
}
